package cn.itcast.dewu.controller;


import cn.itcast.dewu.dto.Result;
import cn.itcast.dewu.service.VoucherOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/*
 * 优惠券订单
 * */
@RestController
@RequestMapping("/voucher-order")
public class VoucherOrderController {
    @Autowired
    private VoucherOrderService voucherOrderService;
    //购买秒杀优惠券
    @PostMapping("seckill/{id}")
    public Result seckillVoucher(@PathVariable("id") Long voucherId) {
        return voucherOrderService.seckillVoucher(voucherId);
    }

    //购买普通优惠券
    @PostMapping("buy/{id}")
    public Result ordinaryVoucher(@PathVariable("id") Long voucherId) {
      return   voucherOrderService.ordinaryVoucher(voucherId);
    }
}
